#!/usr/bin/env python
#!coding=utf-8


import os
import time
import datetime
import sys
import pickle
import random

def run():
    
    #调用dump和load 产生了数据+文件操作
    data = list(range(0,10))
    mdata = list(range(11, 15, 2))
    filename = "./data/tmp.bin"
    print("serilize the data")
    with open(filename, 'wb') as fd:
        pickle.dump(data, fd)
        pickle.dump(mdata, fd)
    
    result = None
    mresult = None
    print("deserilize the file")
    with open(filename, 'rb') as fd:
        result = pickle.load(fd)
        mresult = pickle.load(fd)
    print(result)
    print(mresult)


    #调用dumps和loads只是产生了数据流，但是没有进行文件操作
    sdata = pickle.dumps(data)
    print("the type of sdata is " + str(type(sdata)))
    bdata = pickle.loads(sdata)
    print(bdata)
def random_test():
    data = []
    for each in range(10):
        x = random.random()
        data.append(x)
    print(data)
    currentTime = time.time()
    print(currentTime)  #时间戳
    now = datetime.date.today()
    print(now)
    


if __name__ == "__main__":
    #run()
    random_test()